﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataTier;
using DatabaseTier;

// Mark,Dennis

namespace BusinessTier
{
    public sealed class MovieController
    {
        //static readonly MovieController SingletonInstance = new MovieController();
        private IDBMovie _idbMovie;

        private static readonly Lazy<MovieController> lazy = new Lazy<MovieController>(() => new MovieController());

        private MovieController()
        {
            if (_idbMovie == null)
            {
                _idbMovie = new DBMovie();
            }
        }

        public static MovieController Instance { get { return lazy.Value; } }

        // metoder

        public IMovie FindMovieByID(int id)
        {
            return _idbMovie.FindMovieByID(id);
        }

        public bool InsertMovie(IMovie movie)
        {
            return _idbMovie.InsertMovie(movie);
        }

        public bool RemoveMovie(int id)
        {
            return _idbMovie.RemoveMovie(id);
        }

        public List<IMovie> SearchMovieByActor(string movieActor, bool isMovieCurrent)
        {
            return _idbMovie.SearchMovieByActor(movieActor, isMovieCurrent);
        }

        public List<IMovie> SearchMovieByDirector(string movieDirector, bool isMovieCurrent)
        {
            return _idbMovie.SearchMovieByDirector(movieDirector, isMovieCurrent);
        }

        public List<IMovie> SearchMoviesByTitle(string movieTitle, bool isMovieCurrent)
        {
            return _idbMovie.SearchMoviesByTitle(movieTitle, isMovieCurrent);
        }

        public bool UpdateMovie(IMovie movie)
        {
            return _idbMovie.UpdateMovie(movie);
        }
    }
}
